﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection.Emit;
namespace SscLib
{
    /// <summary>
    /// Defines a Switch symbol.
    /// </summary>
    public class SwitchSymbol : Symbol
    {

        public List<LabelSymbol> JumpPoints = new List<LabelSymbol>();

        /// <summary>
        /// Creates a new Switch symbol with name.
        /// Labels do not have a type. (yet =)
        /// </summary>
        /// <param name="name">Switch name.</param>
        //Todo: verify that Switch do not have a type definition.
        public SwitchSymbol(string name)
            : base(name, null)
        {
        }

        public Label[] JumpTable
        {
            get 
            {
                Label[] jumpTable = new Label[this.JumpPoints.Count];

                for (int i = 0; i < this.JumpPoints.Count; i++)
                {
                    jumpTable[i] = this.JumpPoints[i].Label;
                }

                return jumpTable;
            }
        }
    }
}
